home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / mc51bugs.zip / Q33000 < prev    next >
Text File  |  1988-07-29  |  1KB  |  43 lines

  1. Q33000 Incorrect Code with /Ox and Pointer Assignments
  2. C Compiler
  3. 5.10   | 5.10
  4. MS-DOS | OS/2
  5.  
  6. Summary:
  7.    The code generated for the program below is incorrect when compiled
  8. with full optimization (/Ox). The compiler is attempting to associate
  9. the variable top with the variable p1 in the "while loop" even though
  10. the value of top changed after the assignment to p1.
  11.    Microsoft has confirmed this to be a problem in Version 5.10 of the
  12. C compiler. We are researching this problem and will post new
  13. information as it becomes available.
  14.    You can work around this problem by changing the code as follows:
  15.  
  16. unsigned *p1, *p2, *bottom, *top;
  17.  
  18. fun()
  19.     {
  20.     ++top;
  21.     p1 = top - 1;
  22.     p2 = top;
  23.     while (p1 >= bottom) * p2-- = *p1--;
  24.     }
  25.  
  26. More Information:
  27.      The following is the program that is causing the error:
  28.  
  29. unsigned *p1, *p2, *bottom, *top;
  30.  
  31. fun()
  32.     {
  33.     p1=top;
  34.     p2=++top;
  35.     while (p1 >= bottom)
  36.     *p2-- = *p1--;
  37.     }
  38.  
  39.  
  40.  
  41. Keywords:  buglist5.10 qfbv
  42. Updated  88/07/29 12:16
  43.